package drds.binlog.instance.manager;

import drds.binlog.instance.core.BinlogTask;
import drds.binlog.instance.core.BinlogTaskFactory;
import drds.binlog.instance.manager.model.BinlogTaskInfo;

/**
 * 基于manager生成对应的{@linkplain BinlogTask}
 */
public class ManagerBinlogTaskFactory implements BinlogTaskFactory
{

    private ConfigClient configClient;

    public BinlogTask generate(String destination)
    {
        BinlogTaskInfo binlogTaskInfo = configClient.findCanal(destination);
        String filter = configClient.findFilter(destination);
        return new BinlogTaskWithManager(binlogTaskInfo, filter);
    }

    // ================ setter / getter ================

    public void setConfigClient(ConfigClient configClient)
    {
        this.configClient = configClient;
    }

}
